#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import time
from engine.common import *
if sys.platform == "darwin":
    adbpath = "adb "
else:
    adbpath = "/usr/bin/adb "
if (sys.argv.__len__())<4:
    print( "参数个数少了")
    exit(0)
handset = sys.argv[1]
currentHandsetSnumber = sys.argv[2]
command = sys.argv[3]
resultF = sys.argv[4]

filePath = sys.argv[5]



def inputCnOrNot( handset,currentHandsetSnumber,resultF,filePath="./temp/curl.txt",delay=5 ):
    setHandsetType(handset)
    setHandsetSno(currentHandsetSnumber)
    with open(getHandsetFileSavePath(filePath)) as f:
        print('open this file')
        listText = f.read()
    listText = eval(listText)
    retValue = ""
    for rectFocus in listText:
        if '拼音' in rectFocus[1]:
            retValue = rectFocus

    print(retValue)

    with open(getHandsetFileSavePath(resultF),'w')as f:
        if len(retValue)>0:
            f.write('False')
            return True  #TRUE 状态转移
        else:
            f.write('True')
            return False

if command =="inputCnOrNot".strip():
    inputCnOrNot(handset,currentHandsetSnumber,resultF,filePath)
